* NOTE: You need to set the Stata working directory to the path
* where the data file is located.

set more off

clear
quietly infix                   ///
  str     year       1-9        ///
  str     regiona    10-10      ///
  str     divisiona  11-11      ///
  str     state      12-35      ///
  str     statea     36-37      ///
  str     county     38-94      ///
  str     countya    95-97      ///
  str     cousuba    98-102     ///
  str     placea     103-107    ///
  str     tracta     108-113    ///
  str     blkgrpa    114-114    ///
  str     concita    115-119    ///
  str     aianhha    120-123    ///
  str     res_onlya  124-127    ///
  str     trusta     128-131    ///
  str     aitscea    132-134    ///
  str     anrca      135-139    ///
  str     cbsaa      140-144    ///
  str     csaa       145-147    ///
  str     metdiva    148-152    ///
  str     nectaa     153-157    ///
  str     cnectaa    158-160    ///
  str     nectadiva  161-165    ///
  str     uaa        166-170    ///
  str     cdcurra    171-172    ///
  str     sldua      173-175    ///
  str     sldla      176-178    ///
  str     zcta5a     179-183    ///
  str     submcda    184-188    ///
  str     sdelma     189-193    ///
  str     sdseca     194-198    ///
  str     sdunia     199-203    ///
  str     puma5a     204-208    ///
  str     bttra      209-214    ///
  str     btbga      215-215    ///
  str     name_e     216-1215   ///
  double  myee001    1216-1224  ///
  double  myee002    1225-1233  ///
  double  myee003    1234-1242  ///
  str     name_m     1243-2242  ///
  double  myem001    2243-2251  ///
  double  myem002    2252-2260  ///
  double  myem003    2261-2269  ///
  using `"nhgis0050_ds185_20115_2011_county.dat"'


format myee001   %9.0f
format myee002   %9.0f
format myee003   %9.0f
format myem001   %9.0f
format myem002   %9.0f
format myem003   %9.0f

label var year      `"Data File Year"'
label var regiona   `"Region Code"'
label var divisiona `"Division Code"'
label var state     `"State Name"'
label var statea    `"State Code"'
label var county    `"County Name"'
label var countya   `"County Code"'
label var cousuba   `"County Subdivision Code"'
label var placea    `"Place Code"'
label var tracta    `"Census Tract Code"'
label var blkgrpa   `"Block Group Code"'
label var concita   `"Consolidated City Code"'
label var aianhha   `"American Indian Area/Alaska Native Area/Hawaiian Home Land Code"'
label var res_onlya `"American Indian Area/Alaska Native Area (Reservation or Statistical Entity Only)"'
label var trusta    `"American Indian Reservation with Trust Lands; trust lands only Code"'
label var aitscea   `"Tribal Subdivision/Remainder Code"'
label var anrca     `"Alaska Native Regional Corporation Code"'
label var cbsaa     `"Metropolitan Statistical Area/Micropolitan Statistical Area Code"'
label var csaa      `"Combined Statistical Area Code"'
label var metdiva   `"Metropolitan Division Code"'
label var nectaa    `"New England City and Town Area Code"'
label var cnectaa   `"Combined New England City and Town Area Code"'
label var nectadiva `"New England City and Town Area Division Code"'
label var uaa       `"Urban Area Code"'
label var cdcurra   `"Congressional District (111th Congress) Code"'
label var sldua     `"State Legislative District (Upper Chamber) Code"'
label var sldla     `"State Legislative District (Lower Chamber) Code"'
label var zcta5a    `"5-Digit ZIP Code Tabulation Area Code"'
label var submcda   `"Subminor Civil Division Code"'
label var sdelma    `"School District (Elementary)/Remainder Code"'
label var sdseca    `"School District (Secondary)/Remainder Code"'
label var sdunia    `"School District (Unified)/Remainder Code"'
label var puma5a    `"Public Use Microdata Sample Area (PUMA) Code"'
label var bttra     `"Tribal Census Tract Code"'
label var btbga     `"Tribal Block Group Code"'
label var name_e    `"Estimates: Area Name"'
label var myee001   `"Estimates: Total"'
label var myee002   `"Estimates: Native"'
label var myee003   `"Estimates: Foreign-Born"'
label var name_m    `"Margins of error: Area Name"'
label var myem001   `"Margins of error: Total"'
label var myem002   `"Margins of error: Native"'
label var myem003   `"Margins of error: Foreign-Born"'


